






<div class="admin-biaogelist">

    <div class="listbiaoti am-cf">
        <ul class="am-icon-flag on"> 轮播图列表</ul>

        <dl class="am-icon-home" style="float: right;">当前位置： 首页 > <a href="#">轮播图列表</a></dl>

        <!--<dl>
          <button type="button" class="am-btn am-btn-danger am-round am-btn-xs am-icon-plus" > 补充线订单</button>
        </dl>-->
        <!--这里打开的是新页面-->

    </div>

    <div class="soso">

        <p class="" > <a   style="margin-left: 100px;" class="am-btn am-btn-secondary am-radius excelout"  href="<?php echo base_url()."/Customer/banner"?>">添加轮播图</a></p>
    </div>
    <div class="fbneirong">
        <form class="am-form am-g">
            <table width="100%" class="am-table am-table-bordered am-table-radius am-table-striped am-table-hover">
                <thead>
                <tr class="am-success">
                    <th class="table-check"><input type="checkbox" /></th>
                    <th class="table-id">ID</th>
                    <th class="table-type">标题</th>
                    <th class="table-type">时间</th>
                    <th width="130px" class="table-set">操作</th>
                </tr>
                </thead>
                <tbody class="impowdith">





                </tbody>
            </table>

            <!--  <div class="am-btn-group am-btn-group-xs">
                  <button type="button" class="am-btn am-btn-default"><span class="am-icon-plus"></span> 删除</button>
                  <button type="button" class="am-btn am-btn-default"><span class="am-icon-save"></span> 上架</button>
                  <button type="button" class="am-btn am-btn-default"><span class="am-icon-save"></span> 下架</button>
                  <button type="button" class="am-btn am-btn-default"><span class="am-icon-save"></span> 移动</button>
                  <button type="button" class="am-btn am-btn-default"><span class="am-icon-plus"></span> 新增</button>
                  <button type="button" class="am-btn am-btn-default"><span class="am-icon-save"></span> 保存</button>
                  <button type="button" class="am-btn am-btn-default"><span class="am-icon-archive"></span> 移动</button>
                  <button type="button" class="am-btn am-btn-default"><span class="am-icon-trash-o"></span> 删除</button>
              </div>-->



            <div id="Pagination" style="margin:20px auto" style="display:none"></div>

            <!--  <ul class="am-pagination am-fr">


              </ul>-->




            <hr />

        </form>



    </div>



    <script>







        var on_request=false;
        var type=1;
        var page=1;


        $(".add").click(function () {

                layer.prompt({title: '请输入板块名称，并确认', formType: 2}, function(pass, index){
                    layer.close(index);
                    var url = "<?php echo base_url(); ?>/Customer/addcolumn";
                    var postdata = {
                        'name': pass
                    };
                    $.post(url, postdata, function (data) {
                        if(data.code==0){
                            alert('添加成功');
                            gettasklist();
                            return;
                        }
                        alert('添加失败');
                    },'json');

                });
        });







        function setlisthtnml(data) {
            var html="";


      /*  <a class="am-btn am-btn-default am-btn-xs am-text-success am-round am-icon-file" data-am-modal="{target: '#my-popups'}" title="添加子栏目"></a>*/

            if(data.list.length>0){
                $.each(data.list, function (key, value) {
                     html=html+
                         '<tr  taskid="'+value.id+'" ><td><input type="checkbox" /></td>\n'+
                         '<td>'+value.id+'</td>\n'+
                         '<td>'+value.title+'</td>\n'+
                         '<td>'+value.addtime+'</td>\n'+

                        '<td>'+
                         ''+
                         '<div class="am-btn-toolbar">\n'+
                         '<div class="am-btn-group am-btn-group-xs">\n'+
                         ' <div class="am-btn am-btn-default am-btn-xs am-text-danger am-round del"><span class="am-icon-trash-o"  title="删除"></span> </div>\n'+
                         ' <a class="am-btn "  href="<?php echo base_url()."Customer/editbanner/'+value.id+'"; ?>" title="编辑">编辑</a>\n'+

                         '</div>\n'+
                         '</div>'+
                         ''+
                         '</td></tr>';
                });
                $(".impowdith").html(html);
                $('#Pagination').show();

                $(".del").click(function () {
                    var id=$(this).parents("tr").attr("taskid");
                    del(id);
                });



            }else{
                html += '<li><div style="width:100%;text-align:center;">&nbsp暂无数据</div></li>';
                $(".impowdith").html(html);
                $('#Pagination').hide();
            }


        }



        function del(id) {
            var value=confirm("确认删除该首页轮播图吗");
            if(!value){
                return;
            }
            var url = "<?php echo base_url(); ?>/Customer/delpic";
            var postdata = {
                'id': id
            };
            $.post(url, postdata, function (data) {
                if(data.code==0){
                    alert('删除成功');
                    gettasklist();
                    return;
                }
                alert('删除失败');

            },'json');

        }



        gettasklist();
        function gettasklist() {
            var url = "<?php echo base_url(); ?>/Customer/getpiclist";
            var postdata = {
                'page': page,
                'epage': 50
            };
            $.post(url, postdata, function (data) {
                on_request = false;
                setlisthtnml(data);
                setPagination("Pagination", data.count, page, data.epage, function (clickPage) {
                    page = parseInt(clickPage) + 1;
                    gettasklist();
                });
            },'json');

        }





    </script>










    <div class="foods">
        <ul>
            版权所有@2015.
        </ul>
        <dl>
            <a href="" title="返回头部" class="am-icon-btn am-icon-arrow-up"></a>
        </dl>
    </div>




</div>

</div>




</div>




</body>
</html>